#!/usr/bin/python
# -*- coding: UTF-8 -*-

# @author zhangsheng
# @date 2019/8/5

# 知识点1 => for 语句
arr = ["A", "bike", "baidu", "ali"]
for i in arr:
    print(i)

# 知识点2 =>range()函数:用于生成序列，看成一个生成序列的容器

for index in range(4):  # 遍历 0,1,2,3
    print(index)

print(list(range(4)))  # 整个取出，转为列表： [0, 1, 2, 3]

# 求和
num_sum = 0
for num in range(10):  # num 取0-9
    num_sum = num_sum + num

print(num_sum)  # 45

# 知识点3 =>while 语句
a, b = 0, 1
while a < 10:
    print(a, end=',')
    a, b = b, a + b

# 练习：使用循环语句遍历，将下面列表中的字符串拼接到一起
li = ["i", "love", "you"]

word = ""
for it in li:
    word = word + " " + it
print(word)

word = ""
for i in range(len(li)):
    word = word + " " + li[i]
print(word)
